home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / man / man-part1 / cat1 / fscanf.1 < prev    next >
Text File  |  1999-09-16  |  3KB  |  133 lines

  1.  
  2.  
  3.  
  4. scanf(1)                       Scilab Function                       scanf(1)
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11. NAME
  12.   scanf, fscanf, sscanf - Converts formatted input
  13.  
  14. CALLING SEQUENCE
  15.    [v_1,...v_n]=scanf (format);
  16.    [v_1,...v_n]=fscanf (file,format)
  17.    [v_1,...v_n]=sscanf (string,format)
  18.  
  19. PARAMETERS
  20.  
  21.   format :Specifies the format conversion.
  22.  
  23.   file   :Specifies the input file name or file number.
  24.  
  25.   string :Specifies input to be read.
  26.  
  27. DESCRIPTION
  28.   The scanf,fscanf, and sscanf functions read character data, interpret it
  29.   according to a format, and returns the converted results.
  30.  
  31.   These functions read their input from the following sources:
  32.  
  33.   scanf  :Reads from standard input
  34.  
  35.   fscanf :Reads from the file defined by the file parameter.
  36.  
  37.   sscanf :Reads from the character string specified by the string parameter.
  38.  
  39.          The formatparameter contains conversion specifications used to
  40.          interpret the input.
  41.  
  42.   The format parameter can contain white-space characters (blanks, tabs, new-
  43.   line, or formfeed) that, except in the following two cases, read the input
  44.   up to the next nonwhite-space character. Unless there is a match in the
  45.   control string, trailing white space (including a newline character) is not
  46.   read.
  47.  
  48.        -   Any character except % (percent sign), which must match the next
  49.            character of the input stream.
  50.  
  51.        -   A conversion specification that directs the conversion of the next
  52.            input field.
  53.  
  54. Conversion Specifications
  55.   Each conversion specification in the format parameter contains the follow-
  56.   ing elements:
  57.  
  58.   +    The character % (percent sign)
  59.  
  60.   +    The optional assignment suppression character *
  61.  
  62.   +    An optional numeric maximum field width
  63.  
  64.   +    A conversion code
  65.  
  66.  
  67.   The conversion specification has the following syntax:
  68.  
  69.   [*][width][size]convcode.
  70.  
  71.   The results from the conversion are placed in v_i arguments unless you
  72.   specify assignment suppression with * (asterisk). Assignment suppression
  73.   provides a way to describe an input field that is to be skipped. The input
  74.   field is a string of nonwhite-space characters.  It extends to the next
  75.   inappropriate character or until the field width, if specified, is
  76.   exhausted.
  77.  
  78.   The conversion code indicates how to interpret the input field.
  79.    You should not specify the v_i parameter for a suppressed field. You can
  80.   use the following conversion codes:
  81.  
  82.   %      :Accepts a single % (percent sign) input at this point; no assign-
  83.          ment is done.
  84.  
  85.   d, i   :Accepts a decimal integer;
  86.  
  87.   u      :Accepts an unsigned decimal integer;
  88.  
  89.   o      :Accepts an octal integer;
  90.  
  91.   x      :Accepts a hexadecimal integer;
  92.  
  93.   e,f,g  :Accepts a floating-point number.  The next field is converted
  94.          accordingly and stored through the corresponding parameter, which
  95.          should be a pointer to a float. The input format for floating-point
  96.          numbers is a string of digits, with the following optional charac-
  97.          teristics:
  98.  
  99.          +   It can be a signed value.
  100.  
  101.          +   It can be an exponential value, containing a decimal point fol-
  102.              lowed by an exponent field, which consists of an E or an e fol-
  103.              lowed by an (optionally signed) integer.
  104.  
  105.          +   It can be one of the special values INF, NaN,
  106.  
  107.   s      :Accepts a string of characters.
  108.  
  109.   c      :character value is expected. The normal skip over white space is
  110.          suppressed.
  111.  
  112. SEE ALSO
  113.   printf, read
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.